import 'package:flutter/material.dart';
import 'package:flutter_app/jspangstudydemo/expansion/expansion_panel_list.dart';

class ExpansionTileDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ExpansionTileDemo'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ExpansionTile(
              title: Text('ExpansionTileDemo'),
              leading: Icon(Icons.ac_unit),
              backgroundColor: Colors.white12,
              children: <Widget>[
                ListTile(
                  title: Text('list title'),
                  subtitle: Text('subtitle'),
                ),
              ],
              initiallyExpanded: true, //设置初始化是展开还是关闭，默认（false）关闭
            ),
            RaisedButton(
              child: Text('ExpandPanelList'),
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) {
                      return ExpansionPanelListDemo();
                    },
                  ),
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}
